import 'package:flutter/material.dart';
import 'package:schoollifedemo/commonwidget/common_base_widget.dart';

class TextWidgetWithOverflow extends BaseStatelessWidget {
  final double? width;
  final double? height;

  final String? _text;
  final double radius;
  final Color insideColor;
  final double paddingLeft;
  final double paddingRight;
  final double paddingTop;
  final double paddingBottom;
  final double fontSize;
  final FontWeight fontWeight;
  final Color textColor;

  final TextAlign textAlign;
  final TextOverflow textOverflowType;
  final int maxLine;

  const TextWidgetWithOverflow(
    this._text, {
    Key? key,
    this.width = 200,
    this.height,
    this.radius = 20,
    this.insideColor = const Color(0x33529fe8),
    this.textColor = Colors.black,
    this.fontSize = 24,
    this.paddingBottom = 5,
    this.paddingLeft = 10,
    this.paddingRight = 10,
    this.paddingTop = 5,
    this.textAlign = TextAlign.center,
    this.textOverflowType = TextOverflow.ellipsis,
    this.maxLine = 1,
    this.fontWeight = FontWeight.normal,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width,
      height: height,
      padding: EdgeInsets.only(
          left: paddingLeft,
          right: paddingRight,
          top: paddingTop,
          bottom: paddingBottom),
      decoration: BoxDecoration(
        color: insideColor,
        borderRadius: BorderRadius.circular(radius), // 圆角度
      ),
      child: Row(
        children: [
          Expanded(
            child: Text(
              _text ?? '',
              textAlign: textAlign,
              overflow: textOverflowType,
              maxLines: maxLine,
              style: TextStyle(
                fontSize: fontSize,
                color: textColor,
                fontWeight: fontWeight,
              ),
            ),
          ),
        ],
      ),
    );
  }
}
